package CH01_05; /**
 * Created by lenovo on 2016/3/20.
 */
import java.math.BigDecimal;

public class DecumalDemo {
    public static void main(String[] args) {
        BigDecimal operand1 = new BigDecimal("1.0");
        BigDecimal operand2 = new BigDecimal("0.8");
        BigDecimal result = operand1.subtract(operand2);
        System.out.println(result);

        BigDecimal op1 = new BigDecimal("0.1");
        BigDecimal op2 = new BigDecimal("0.1");
        BigDecimal op3 = new BigDecimal("0.1");
        BigDecimal result2 = new BigDecimal("0.3");
        if(op1.add(op2).add(op3).equals(result2)) {
            System.out.println("等于 0.3");
        }
        else {
            System.out.println("不等于 0.3");
        }
    }
}
